<!doctype html>

<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta name='gwt:property' content='locale=en'>

    <title>Yui4Gwt example gallery</title>
    <script type="text/javascript" language="javascript" 
    	src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js"></script>
  </head>
  <body class="yui3-skin-sam">
  

<script type="text/javascript">
YUI({
    //Last Gallery Build of this module
    gallery: 'gallery-2012.06.06-19-59'
}).use("dump", "node", "datasource-local", "datasource-arrayschema", "datasource-jsonschema", "datasource-xmlschema", function (Y) {
var myDataArray = [
    {name:"abc",id:123,extra:"foo"},
    {name:"def",id:456,extra:"bar"},
    {name:"ghi",id:789,extra:"baz"}
],

myDataSourceArray = new Y.DataSource.Local({source:myDataArray}),

myCallbackArray = {
    success: function(e){
        Y.one("#demo_output_array").setHTML(Y.dump(e.response));
    },
    failure: function(e){
        Y.one("#demo_output_array").setHTML("Could not retrieve data: " + e.error.message);
    }
};

myDataSourceArray.plug(Y.Plugin.DataSourceArraySchema, {
    schema: {
        resultFields: ["name","id"]
    }
});

Y.on("click", function(e){
    myDataSourceArray.sendRequest({callback:myCallbackArray});
}, "#demo_array");
});
</script>

  </body>
</html>
